-
-
Notifications
You must be signed in to change notification settings - Fork 81
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add: the start of dart lang support #2671
Conversation
What you have done here looks right, but you haven't actually added anything. You need to flesh out the The Tree sitter query syntax is defined here: The snippet definition have moved to Talon community so you shouldn't really focus on that in Cursorless. |
Hello @AndreasArvidsson, I have added a humble beginning of adding language support starting with the if statement, but for some reason when I run the extension locally, and I have a code snippet like this : |
The snippets have nothing to do with the language definition in the scm files. The snippets are a separate system that is being deprecated in favor of the community First you need a language definition in vscode for dart. ie you need to install a dart extension so that vscode correctly recognizes the file as the language dart. You can see in the bottom right corner which language vscode has associated with the current document. Once that is done and you have added a scope in their scm file for example if statement you should be able to say. |
You'll need to run After that is fixed you're going to get an error saying you're missing a test for the |
almost there! looks like you've forgotten to run step 6 of the docs I believe. But possible you already ran that and something is broken have you tested the scope manually either using scope visualiser or "take if state"? |
@pokey Yes I have tested with Side question: I’m running into errors with query code copied from JavaScript, even though Dart has identical syntax in terms of arrays and maps (called lists in dart not sure if that detail matters). Errors like Query code:
Language scope code: import type { LanguageScopeSupportFacetMap } from "./scopeSupportFacets.types";
import { ScopeSupportFacetLevel } from "./scopeSupportFacets.types";
const { supported, unsupported, notApplicable } = ScopeSupportFacetLevel;
export const dartScopeSupport: LanguageScopeSupportFacetMap = {
list: supported,
map: supported,
ifStatement: supported,
}; |
Ah right yeah those docs are kind of missing a step. You need to ensure that the subset of tests you're running is the dart tests, if you've not done that already. See test subset doc for more
Is |
@pokey sorry to sound like a noob, but how can I figure out if If that is the case, when I scaffold the file and look for object mentions, I see some mentions of it, but not sure if it relates link to Thanks! |
See the tips. In particular, if you make a file with a map in it and say "parse tree file" you will see the parse tree. And fwiw here is the tree-sitter grammar for dart |
Hi, I'm having trouble recording tests and can’t figure out what I might be doing wrong. I've added what I believe is the correct fixture for the single
I’m not sure what the test recorder should be doing here, and it doesn’t seem to be working as expected. If the only file that's supposed to be changed is the fixtures file, why are the tests still failing? Any guidance would be helpful I am so lost. |
Replace that whole If that voice command isn't working try saying "bar run" to pull up the debugging sidebar and in the top dropdown select |
Thank you! Tests passed in ci, time to do the first merge? 😁 Or should I add more scopes? |
That's curious. What happens when you pull up |
output for visualize if state: output for parse tree file: Cursorless parse treedart.dart [0:0-5:0]hi() {
if (true) {
return true;
}
}
(program
(function_signature
name: (identifier)
(formal_parameter_list
"("
")"
)
)
(function_body
(block
"{"
(if_statement
"if"
"("
(true
"true"
)
")"
consequence: (block
"{"
(return_statement
"return"
(true
"true"
)
";"
)
"}"
)
)
"}"
)
)
) program [0:0-5:0]
function_signature [0:0-0:4]
name: identifier [0:0-0:2]
formal_parameter_list [0:2-0:4]
"(" [0:2-0:3]
")" [0:3-0:4]
function_body [0:5-4:1]
block [0:5-4:1]
"{" [0:5-0:6]
if_statement [1:2-3:3]
"if" [1:2-1:4]
"(" [1:5-1:6]
true [1:6-1:10]
"true" [1:6-1:10]
")" [1:10-1:11]
consequence: block [1:12-3:3]
"{" [1:12-1:13]
return_statement [2:4-2:16]
"return" [2:4-2:10]
true [2:11-2:15]
"true" [2:11-2:15]
";" [2:15-2:16]
"}" [3:2-3:3]
"}" [4:0-4:1] |
Wait so "take if state" works but "visualize if state" doesn't? |
It might be helpful if you say "bar cursorless" with that file open and send a screenshot |
Just to be sure: you're running "visualize if state" from the debug vscode instance, not the host instance? |
ok cool. what happens if you use exactly the file if(true) { } like in your test case? |
That file is different from the one in your test case. Notice that it is 3 lines but your test case is only 1 line |
modified the ifStatement scope to be valid code, thanks for the pointers |
Hi what am I missing from my test fixtures exactly is there something I need to do regarding cursor placement that can be specified in the fixture?? |
you just need to re-run update fixtures and you should be good to go |
@pokey the fixtures are already valid dart code with an if statement, I don't understand what needs to be updated, or rather why the tests were failing it's a valid |
when I look at the other fixtures they have these content in domain things in them and I don't know how you get those like this in javascript for the if statement:
so very clearly I'm missing something in the way that I'm constructing these tests because these are not showing up. |
Have you tried re-running update fixtures? |
Sorry to be so opaque. Basically these tests have two sections. The section above the When you fixed the dart code, notice that CI started failing, because the fixture says there should be no scopes but now it finds one Running update fixtures will replace the section below the Make sense? |
I think I understand, that lower section updated, thank you for your patience |
I think I'm getting the hang of this! I added the list and map scopes I think this should be enough for an initial PR |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We have lift-off! 🚀🙌
Hello, hopefully I did these first steps right and I would like some rough guidance on adding the subsequent things like snippets or any other essentials for dart support, thanks!
Checklist